package com.fruit.tool.util;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 
 * @author jinghao.liang
 *
 */
public class ImageUtil {
	private static Logger log = LoggerFactory.getLogger(ImageUtil.class);
	
	public static BufferedImage readImage (String path) {
		File imgFile = new File(path);
		BufferedImage bufImg = null;
		try {
			bufImg = ImageIO.read(imgFile);
		} catch (IOException e) {
			log.error("读取的文件不存在", e);
		}
		if(bufImg == null) {
			return null;
		}
		bufImg.flush();
		return bufImg;
	}
}
